package DesignModel.Singleton;

/*
 * Author: JacksonCoder
 * FileName: SingletonPattern
 * Version: 1.0.0
 * Date: 2025/2/27
 */

public class SingletonPattern {

    public static void main(String[] args) {
        // 获取单例实例
        DatabaseConnectionPool pool1 = DatabaseConnectionPool.getInstance();
        DatabaseConnectionPool pool2 = DatabaseConnectionPool.getInstance();

        // 检查是否是同一个实例
        System.out.println("pool1 == pool2: " + (pool1 == pool2)); // 输出 true

        // 使用连接池
        pool1.getConnection();
        pool2.getConnection();
    }

}
